package com.zc.common;

import lombok.Data;

import java.io.Serializable;

/**
 * @description:
 * @author: cong
 * @create: 2024/9/29
 */
@Data
public class BaseResult<T> implements Serializable {
    private static final long serialVersionUID = 1L;
    private Integer code;
    private String msg;
    private T data;

    public BaseResult() {
    }

    public BaseResult(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static <T> BaseResult success(String msg, T data) {
        return new BaseResult(200,msg, data);
    }

    public static BaseResult fail(String msg) {
        return new BaseResult(500, msg, null);
    }
}
